﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.ComponentModel;

using P2PLib.Client.ViewModel;
using P2PLib.Client.DataModel;


namespace NewPanda.ViewModel
{
    /// <summary>
    /// 与FileSharePanel绑定的ViewMode;
    /// </summary>
    public class FileShareViewModel
    {
        private ObservableCollection<DownloadTaskViewModel> taskList;
        private ObservableCollection<LocalFileInfo> fileList;

        public FileShareViewModel()
        {
            this.taskList = new ObservableCollection<DownloadTaskViewModel>();
            this.fileList = new ObservableCollection<LocalFileInfo>();
        }

        public FileShareViewModel(DownloadTaskList tl, SharedFileLibrary fl)
        {
            this.taskList = new ObservableCollection<DownloadTaskViewModel>();
            this.fileList = new ObservableCollection<LocalFileInfo>();

            foreach(DownloadTask dt in tl.Tasks)
            {
                taskList.Add(new DownloadTaskViewModel(dt));
            }

            foreach (LocalFileInfo f in fl.Files)
            {
                this.fileList.Add(f);
            }
        }

        public ObservableCollection<DownloadTaskViewModel>  TaskList
        {
            get
            {
                return this.taskList;
            }
            set
            {
                this.taskList = value;
            }
        }

        public ObservableCollection<LocalFileInfo> FileList
        {
            get
            {
                return this.fileList;
            }
            set
            {
                this.fileList = value;
            }
        }
    }
}
